*don't knows: 
gen dk = (VCF0803==9)

gen libcontherm_mod = libcon
recode libcontherm_mod 0/45=1 46/55=2 56/100=3
scatter ideo1 libcontherm_mod, jitter(50)

*******************************
****PID-Ideological sorting****
*******************************
*Ideological strength coded 1-4
gen ideostr1_alt=4 if libcon7==1 | libcon7 ==7
replace ideostr1_alt =3 if libcon7 ==2 | libcon7 ==6
replace ideostr1_alt =2 if libcon7 ==3 | libcon7 ==5
replace ideostr1_alt =1 if libcon7 ==4
replace ideostr1_alt = 1 if libcontherm_mod==2 & dk==1
replace ideostr1_alt = 2 if libcontherm_mod !=2 & dk==1

*Partisan and Ideological Strength, combined
gen pidideostr1_alt=pidstr1*ideostr1_alt
*Alignment between partisan and ideological strength


gen ideo1alt =libcon7
recode ideo1alt 9=.
replace ideo1alt = 4 if libcontherm_mod==2 & dk==1
replace ideo1alt = 3 if libcontherm_mod==1 & dk==1
replace ideo1alt = 5 if libcontherm_mod==3 & dk==1

gen overlapalt=abs(pid1-ideo1alt)+1
omscore overlapalt
replace overlapalt=rr_overlapalt

*Full sorting measure
gen overlapxstr_alt=overlapalt*pidideostr1_alt
gen sortingalt = (overlapxstr_alt-7)/105

